package com.zjn.servicec.service.Imp;

import com.zjn.entity.Contact;
import com.zjn.servicec.dao.ContactDao;
import com.zjn.servicec.service.ContactService;
import lombok.extern.log4j.Log4j2;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author zaker
 * @program: signit_parent
 * @date 2021-04-01 11:26
 */
@Service
public class ContactServiceImp implements ContactService {
    private static final Logger LOG = LoggerFactory.getLogger(ContactServiceImp.class);

    @Autowired
    private ContactDao contactDao;

    @Override
    public String updateIdentity(Contact contact) {
        return null;
    }

    @Override
    public Contact findContactById(Short id) {
        return contactDao.selectByPrimaryKey(id);
    }

    @Override
    public String createContact(Contact contact) {
        LOG.info("创建联系人信息",contact);
        int result=contactDao.insertSelective(contact);
        if (result==1) {
            return "OK";
        }else{
            return "ERROR";
        }
    }
}
